public class Text1 {
    // 牛客 反转链表
    public ListNode ReverseList (ListNode head) {
        // write code here
        ListNode pre = null;
        ListNode cur = head;

        while(cur!=null){
            ListNode tmp = cur.next;
            cur.next = pre;
            pre = cur;
            cur = tmp;
        }

        return pre;
    }
}
